﻿Imports TwitterVB2

Public Class frmRoleModel

    Dim tw As New TwitterAPI
    Private IsFormBeingDragged As Boolean = False
    Private MousePos As New System.Drawing.Point(0, 0)

    Private Sub txtRoleModel_GotFocus(sender As Object, e As System.EventArgs) Handles txtRoleModel.GotFocus

        If txtRoleModel.Text = "@TwitterUsername" Then

            txtRoleModel.Text = ""

        End If

    End Sub

    Private Sub btnSearch_Click(sender As System.Object, e As System.EventArgs) Handles btnSearch.Click

        'Me.Height = 334

        Dim i As Integer

        For i = 109 To 334

            Me.Height = i

        Next

        tw.AuthenticateWith(frmMain.consumer, frmMain.consumersecret, My.Settings.m_strToken, My.Settings.m_strTokenSecret)

        For Each TwitterList In tw.ListsGet(txtRoleModel.Text)

            lstRoleFollowers.Items.Add(TwitterList.Name & " " & TwitterList.MemberCount.ToString)

        Next

    End Sub

    Private Sub PictureBox2_MouseDown(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles PictureBox2.MouseDown

        If e.Button = MouseButtons.Left Then

            IsFormBeingDragged = True

            MousePos = e.Location

        End If


    End Sub

    Private Sub PictureBox2_MouseMove(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles PictureBox2.MouseMove

        If IsFormBeingDragged Then

            Dim temp As Point = New Point(Me.Location + (e.Location - MousePos))
            Me.Location = temp
            temp = Nothing

        End If

    End Sub

    Private Sub PictureBox2_MouseUp(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles PictureBox2.MouseUp

        If e.Button = MouseButtons.Left Then IsFormBeingDragged = False

    End Sub

    Private Sub lblMin_Click(sender As System.Object, e As System.EventArgs) Handles lblMin.Click

        On Error Resume Next

        'If Me.WindowState = FormWindowState.Minimized Then

        Me.Visible = False

        'End If

    End Sub

    Private Sub lblExit_Click(sender As System.Object, e As System.EventArgs) Handles lblExit.Click

        Me.Visible = False

    End Sub

    Private Sub frmRoleModel_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load

        Me.Height = 109

        lblMin.Parent = PictureBox2
        lblMax.Parent = PictureBox2
        lblExit.Parent = PictureBox2

        lblMin.BackColor = Color.Transparent
        lblMax.BackColor = Color.Transparent
        lblExit.BackColor = Color.Transparent

    End Sub

End Class